import junit.framework.TestCase;


public class MyLLStackTest extends TestCase {
	
	private class TestType<T>{	
		
		public void testGeneralAction(T[] testBench){
			// initial test
			MyLLStack<T> ms = new MyLLStack<T>();
			MyLLStack<T> ms1 = new MyLLStack<T>();
			assertTrue("The initial stack is not empty",ms.isEmpty());
			
			//test push and pop
			for (int i=0; i < testBench.length; i++){
				ms.push(testBench[i]);
				assertTrue("The stack does not contain the element right after which has been added into the stack",
						ms.contains(testBench[i]));
				// not just push pop test
				if (i%2 == 0){
					assertTrue("The stack did not pop the last pushed element", ms.pop().equals(testBench[i]));
				}
			}
			
			for(int i=0; i < testBench.length; i++){
				ms1.push(testBench[i]);
			}
			
			while (!ms1.isEmpty()){
				System.out.println(ms1.pop());
			}	
		}
		
	
	}
	
	public MyLLStackTest(){
		
	}
	protected void setUp() throws Exception {
		super.setUp();
		
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testGeneral(){
		TestType<String> tt = new TestType<String>();
		String[] testBench = {"i", "am", "Yuan", "Li", "there", "pittsburgh", "cmu", "hello", "world", "this"};
		tt.testGeneralAction(testBench);
	}

}
